package cn.tedu.d17_thread;
/*
 测试Runnable类创建线程
 */
public class Test2_Thread {
    public static void main(String[] args) {

        MyRunnable target=new MyRunnable();
        Thread t=new Thread(target,"孙悟空");
        Thread t2=new Thread(target,"齐天大圣");
        Thread t3=new Thread(target,"猪八戒");
        Thread t4=new Thread(target,"沙僧");

        t.start();
        t2.start();
        t3.start();
        t4.start();



    }

}

class MyRunnable implements Runnable{


    @Override
    public void run() {
        for (int i = 0; i <100; i++) {
            System.out.println(i+" "+Thread.currentThread().getName());

        }
    }
}
